package xyz.weizhi.pojo;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

import javax.annotation.Resource;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import java.util.Set;

/**
 * @Author milian
 * @Date 2021/9/4 0004 17:09
 */
public class Student {
    private String name;
    // 在自动装配复杂的情况下，可以使用Qualifier注解配合Autowired使用
    @Autowired
    @Qualifier(value = "address")
    private Address address;
    private String[] books;
    private List<String> hobbys;
    private Set<String> games;
    private Map<String,String> card;
    private String wife;
    // 默认通过byName方式实现，如果找不到，则通过byType实现，都找不到就报错
    @Resource()
    private User user;

    public User getUser() {
        return user;
    }

    public void setUser(User user) {
        this.user = user;
    }

    public String getWife() {
        return wife;
    }

    public void setWife(String wife) {
        this.wife = wife;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public Address getAddress() {
        return address;
    }

    public void setAddress(Address address) {
        this.address = address;
    }

    public String[] getBooks() {
        return books;
    }

    public void setBooks(String[] books) {
        this.books = books;
    }

    public List<String> getHobbys() {
        return hobbys;
    }

    public void setHobbys(List<String> hobbys) {
        this.hobbys = hobbys;
    }

    public Set<String> getGames() {
        return games;
    }

    public void setGames(Set<String> games) {
        this.games = games;
    }

    public Map<String, String> getCard() {
        return card;
    }

    public void setCard(Map<String, String> card) {
        this.card = card;
    }

    @Override
    public String toString() {
        return "Student{" +
                "name='" + name + '\'' +
                ", address=" + address +
                ", books=" + Arrays.toString(books) +
                ", hobbys=" + hobbys +
                ", games=" + games +
                ", card=" + card +
                ", wife='" + wife + '\'' +
                ", user=" + user +
                '}';
    }
}
